package com.glela.order.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.glela.order.model.OrderPay;

public interface OrderPayMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(OrderPay orderPay);

    int insertSelective(OrderPay orderPay);

    OrderPay selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(OrderPay orderPay);

    int updateByPrimaryKey(OrderPay orderPay);

	List<OrderPay> selectByOrderSn(@Param("orderSn") String orderSn, @Param("payType") int payType);
	
	List<OrderPay> selectPaySuccessByOrderSn(@Param("orderSn") String orderSn, @Param("payType") int payType);

	/**
	* 按照父订单查询支付成功的订单(按照创建时间升序排序)
	* @author gaoweiqi
	* @date 2017年8月19日 12:44:05
	*
	**/
	List<OrderPay> selectPaySuccessByOBJOrderSn(@Param("orderSn") String orderSn);
	
	int selectPaySuccessCountByOrderSn(@Param("orderSn") String orderSn);
	
	int invalidByPaySn(@Param("paySn") String paySn,@Param("currTime") String currTime);

	int effectByPaySn(@Param("paySn") String paySn,@Param("currTime") String currTime);

	OrderPay selectByPaySn(@Param("paySn") String paySn);

	OrderPay selectByExternalId(@Param("externalId") String externalId);
	
	List<OrderPay> selectOrderPayInfoById(@Param("settlementId") Long settlementId);
	
	List<OrderPay> selectAllByOrderSn(@Param("orderSn") String orderSn);

	int updateStatusOkById(@Param("id") int id, @Param("payId") String payId, @Param("payTime") String payTime);
}
